import { defineStore } from 'pinia';
import { computed, ref } from 'vue';
import { useCounter2Store } from './counter2';

// 这个函数我们一般起名格式形如：useXxxStore
export const useCounterStore = defineStore('counter', () => {
  const counter2Store = useCounter2Store();

  const count = ref(0);

  const doubleCount = computed(() => count.value * 2);

  const addCount = () => {
    // count.value++;
    counter2Store.count++;
  };

  return { count, addCount, doubleCount };
});
